#include <reg52.h>
#include "PCF8574.h"
#include "delay.h"
#include "key.h"
#include "tea5767.h"

void init(){
	//LCD_open();
	key_open(Hight);
	radio_open();
}

unsigned char *num_to_str(unsigned long num){
	static unsigned char str[12]="    .      ";
	str[0] = num/100000+'0';
	str[1] = num%100000/10000+'0';
	str[2] = num%10000/1000+'0';str[3]='.';
	str[4]=num%1000/100+'0';
	str[5]=num%100/10+'0';
	str[6]=num%10/1+'0';
	return str;
}

void main(){
	unsigned char key_num=0xff;
	long freq;
	
	init();
	//LCD_write("FM:    ",0,1);
	//LCD_write("KN:    ",0,2);
	while(1){
		key_num = key_read();
		if(key_num!=0x33){
			//LCD_write(num_to_str(key_num),4,2);
			tea767_auto_search(1);
		}
		//radio_write("",key_num,1);
		//freq = radio_read();
		//LCD_write(num_to_str(freq),4,1);
		
	}
}